<? 
session_start();
if(!session_is_registered(uid)){
    echo "You have to login to view this page!</br></br>";
    echo "Click here to return to the "; 
    echo '<a href="./../index.php" title="Login">Login Page</a></br></br>';
    echo "Or sign up using this link ";
    echo '<a href="./../Registration/registration.html" title="Registration">Registration Page</a>';
exit();
}
else

    //Manual SQL COnnection
    $con = mysql_connect("localhost", "root", "root") or die ( "Error connectiong to DB: ".mysql_error());
       
    mysql_select_db("reeferslog", $con) or die ( "Error selecting specific DB, reefeerslog: ".mysql_error());
    
    //SQL to get user_id from session
    $gettank = "select * from tank where user_id='". $_SESSION['uid'] ."'";
    
    $result=mysql_query($gettank);
    
    $values=mysql_fetch_array($result);
    
    $rows=mysql_num_rows($result);
    
    $i=0;
    while($i<$num) {
        
        $f1=mysql_result($result,$i,"tanktype");
        $f2=mysql_result($result,$i,"size");
        $f3=mysql_result($result,$i,"manufacturer");
        $f4=mysql_result($result,$i,"datesetup");
        $f5=mysql_result($result,$i,"cost");        
        
        echo "<b>$f1-name $f2-name2</b><br>$f3-name<br>$f4-name<br>$f5-name<hr><br>";
     
        $i++;
    }
    
    
    //Close SQL input
    mysql_close($con);
?>

<html>
<head>
      <title></title>
 </head>

<body>

<form  id ="form3" name="AddTank" method="post" action="addtank.php">
                    <table border="1">
                                              
                        <tbody>
                            <tr>
                                <td><label>Tank Type:</label>
                                    <select name="tanktype" required="required">
                                    <option>Display</option>
                                    <option>Sump</option>
                                    <option>Frag</option>
                                    <option>QT</option>
                                </select></td>
                                
                                <td><label>Tank Size:</label> <input type="integer" name="size" value="<?php echo $values[size]?>" required="required" /></td>
                            </tr>
                            <tr>
                                <td><label>Manufacturer:</label> <input type="text" name="manufacturer" value="<?php echo $values[manufacturer]?>" /></td>
                                <td><label>Date Setup:</label> <input type="text" name="date" value="<?php echo $values[date]?>" /></td>
                            </tr>
                            <tr>
                                <td><label>Cost:</label> <input type="integer" name="cost" value="<?php echo $values[cost]?>" /></td>
                                <!--<td> <input align="center" type="submit" value="Add Tank" name="Add Tank!" action="addtank.php" /></td>-->
                        </tbody>                                                               
                    </table>                                                 
                </form>

</body>

</html>
